<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <style>
        body {
            margin: 0;
            padding: 20px 20px 80px 20px; /* 底部添加额外padding为固定按钮留空间 */
            min-height: 100vh;
            box-sizing: border-box;
        }

        .option-list {
            margin: 0;
            border: 1px solid #eee;
            border-radius: 6px;
            overflow: hidden;
        }
        .option-item {
            display: flex;
            align-items: center;
            margin-bottom: 10px;
            background: #fafafa;
            padding: 8px 12px;
            border: 1px solid #ddd;
            border-radius: 4px;
            border-bottom: 1px solid #eee;
        }
        .option-item:last-child {
            border-bottom: none;
        }
        .delete-btn {
            margin-left: 10px;
            cursor: pointer;
            color: red;
        }
        .button-group {
            margin: 20px;
            display: flex;
            align-items: center;
        }
        .button-group button {
            margin-right: 10px;
            padding: 8px 16px;
            border: 1px solid #ddd;
            background: white;
            border-radius: 4px;
            cursor: pointer;
        }
        .button-group button:hover {
            background: #f5f5f5;
        }
        .drag-handle {
            cursor: move;
            padding: 0 8px;
            color: #666;
            user-select: none;
        }
        .option-item input {
            flex: 1;
            margin: 0 10px;
            padding: 4px;
        }
        .option-item.dragging {
            opacity: 0.4;
        }
        .section-title {
            margin: 20px;
            font-size: 16px;
            color: #333;
            font-weight: 500;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .fixed-option-item {
            background: #f5f5f5;
        }
        
        .fixed-option-item .delete-btn,
        .fixed-option-item .drag-handle {
            visibility: hidden;
        }

        .fixed-bottom {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background: #f8f9fa;
            padding: 15px 20px;
            box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
            display: flex;
            justify-content: flex-end;
            z-index: 1000;
            border-top: 1px solid #eee;
        }

        #saveBtn {
            background-color: #336dab;
            color: white;
            border: none;
            padding: 10px 24px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 14px;
            transition: background-color 0.2s;
        }

        #saveBtn:hover {
            background-color: #2a5a8e;
        }

        #saveBtn:active {
            transform: translateY(1px);
        }

        .add-button {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background-color: #f8f9fa;
            color: #336dab;
            border: 1px dashed #336dab;
            padding: 6px 12px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 13px;
            transition: all 0.2s;
        }

        .add-button:hover {
            background-color: #edf5ff;
            border-style: solid;
        }

        .add-button:active {
            transform: translateY(1px);
        }

        .add-button::before {
            content: '+';
            font-size: 16px;
            font-weight: bold;
        }

        .section-divider {
            margin: 30px 20px;
            border: none;
            border-top: 1px solid #eee;
        }

        .settings-container {
            margin: 0;
        }

        .setting-item {
            display: flex;
            align-items: center;
            margin-bottom: 0;
        }

        .setting-item label {
            flex: 0 0 140px;
            font-size: 14px;
            color: #333;
        }

        .setting-select {
            flex: 0 0 200px;
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 14px;
            background-color: white;
        }

        .setting-select:focus {
            outline: none;
            border-color: #336dab;
            box-shadow: 0 0 0 2px rgba(51, 109, 171, 0.2);
        }

        .page-title {
            font-size: 20px;
            color: #333;
            margin: 24px 20px;
            font-weight: 500;
        }

        .config-section {
            background: white;
            border: 1px solid #eee;
            border-radius: 8px;
            margin: 0 20px 24px 20px;
            padding: 20px;
        }

        .section-header {
            font-size: 16px;
            color: #333;
            margin: 0 0 16px 0;
            font-weight: 500;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .config-group {
            margin-bottom: 24px;
        }

        .config-group:last-child {
            margin-bottom: 0;
        }

        .config-group-title {
            font-size: 14px;
            color: #666;
            margin-bottom: 12px;
        }
    </style>
</head>
<body>
    <h1 class="page-title">扩展配置</h1>

    <!-- 功能设置部分 -->
    <div class="config-section">
        <h2 class="section-header">功能设置</h2>
        <div class="settings-container">
            <div class="setting-item">
                <label for="kubectlOpenType">kubectl 打开方式：</label>
                <select id="kubectlOpenType" class="setting-select">
                    <option value="current">当前页面</option>
                    <option value="tab">新标签页</option>
                    <option value="window">新窗口</option>
                </select>
            </div>
        </div>
    </div>

    <!-- 集群和命名空间配置部分 -->
    <div class="config-section">
        <h2 class="section-header">资源配置</h2>
        
        <!-- 集群配置 -->
        <div class="config-group">
            <div class="config-group-title">
                集群列表
                <button id="addNewClusterBtn" class="add-button">添加集群</button>
            </div>
            <div class="option-list" id="clusterList">
                <!-- 集群选项列表将通过 JS 动态生成 -->
            </div>
        </div>

        <!-- 命名空间配置 -->
        <div class="config-group">
            <div class="config-group-title">
                命名空间列表
                <button id="addNewBtn" class="add-button">添加命名空间</button>
            </div>
            <div class="option-list" id="optionList">
                <!-- 命名空间选项列表将通过 JS 动态生成 -->
            </div>
        </div>
    </div>

    <!-- 保存按钮 -->
    <div class="fixed-bottom">
        <button id="saveBtn">保存配置</button>
    </div>

    <script type="module" src="../common/toast.js"></script>
    <script type="module" src="options.js"></script>
</body>
</html>